<!--
 账单详细
 -->
<template>
  <div class="bill-detial-page">
    <van-nav-bar class="nav" title="提现明细" left-arrow @click-left="onClickLeft" fixed />
    <div class="content">
      <div class="top-row">
        <div class="title">提现申请</div>
        <div class="money">-{{detail.amount}}</div>
      </div>
      <div class="detail-row">
          <div class="cell">
            <span class="label">当前状态</span>
            <span>{{status2Str(detail.status)}}</span>
          </div>
          <div class="cell" v-if="detail.status == -1">
            <span class="label">失败原因</span>
            <span>{{detail.info}}</span>
          </div>
          <div class="cell">
            <span class="label">提现银行</span>
            <span>{{detail.bankName}}({{detail.cardNo&&detail.cardNo.slice(-4)}}) {{detail.cardName}}</span>
          </div>
          <div class="cell">
            <span class="label">提现单号</span>
            <span>{{detail.recordNo}}</span>
          </div>
        <div class="cell van-hairline--top" >
          <span class="label">创建时间</span>
          <span>{{formatTime(detail.createTime)}}</span>
        </div>
        <!-- <div class="cell" >
          <span class="label">账单编号</span>
          <span>{{detail.recordSn}}</span>
        </div> -->
      </div>
    </div>
  </div>
</template>
<script>
import Vue from "vue";
import { format } from "@/utils/util";
import { NavBar, Toast } from "vant";
import { mapState } from 'vuex';
Vue.use(Toast).use(NavBar);
export default {
  data() {
    return {
      id: this.$route.query.id, 
      detail:{}
    };
  },
  created(){
    this.getDetail();
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    status2Str(status) {
      switch (status) {
        case -1:
          return '提现失败'
        case 0:
          return '处理中'
        case 1:
          return '提现成功'  
        case 2:
          return '待处理'    
      }
    },
    getDetail() {
      this.$http
        .post("/account/withdraw/detail", { id: this.id })
        .then(res => {
          this.detail = res.info || {}
        })
    },
    formatTime(time) {
      return format(time, "yyyy-MM-dd hh:mm:ss");
    }
  }
};
</script>
<style lang="scss" scoped>
.bill-detial-page {
  .content {
    padding-top: 66px;
    background: #fff;
    .top-row {
      padding: 20px 15px 50px;
      text-align: center;
      .title {
        font-size: 14px;
        margin-bottom: 10px;
      }
      .money {
        font-size: 20px;
      }
    }
    .detail-row {
      .cell {
        padding: 0 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 50px;
        font-size: 13px;
        .label {
          color: #999;
        }
      }
      .goos-list {
        padding-top: 15px;
      }
      .goods-item {
        display: flex;
        height: 80px;
        padding: 0 15px 15px;
        box-sizing: content-box;
        .col-1 {
          width: 80px;
          height: 80px;
          background: #eee;
          margin-right: 15px;
          flex-shrink: 0;
          img{
            width: 100%;
            height: 100%;
          }
        }
        .col-2 {
          width: calc(100% - 100px);
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          .title {
            width: 100%;
            font-size: 14px;
            &.one-over{
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
            &.two-over{
              display: -webkit-box;
              -webkit-box-orient: vertical;
              -webkit-line-clamp: 2;
              overflow: hidden;
            }
          }
          .num{
            color: #999;
          }
          .money-row {
            display: flex;
            justify-content: space-between;
            .profit {
              color: $red;
            }
          }
        }
      }
    }
  }
}
</style>